package io.geekidea.boot.otherstores.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import io.geekidea.boot.framework.service.impl.BaseServiceImpl;
import io.geekidea.boot.otherstores.dto.addOtherStore;
import io.geekidea.boot.otherstores.dto.updateOtherStore;
import io.geekidea.boot.otherstores.entity.OtherStores;
import io.geekidea.boot.otherstores.entity.Stores;
import io.geekidea.boot.otherstores.mapper.OtherStoresMapper;
import io.geekidea.boot.otherstores.query.OtherQuery;
import io.geekidea.boot.otherstores.query.total;
import io.geekidea.boot.otherstores.service.OtherService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OtherServiceImpl extends ServiceImpl<OtherStoresMapper,OtherStores> implements OtherService{

    @Resource
    private OtherStoresMapper otherStoresMapper;


    @Override
    public List<OtherStores> findByList(OtherQuery otherQuery) {

        return otherStoresMapper.findByList(otherQuery);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean delById(Integer id) {

        return otherStoresMapper.delByIdInt(id)>0;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateOtherStore(updateOtherStore updateOtherStore) {
        return otherStoresMapper.updateOtherStore(updateOtherStore)>0;
    }

    @Override
    public List<Stores> getStoreList(Integer areaId) {
        return otherStoresMapper.getStoreList(areaId);
    }


    @Override
    public OtherStores getStore(Integer id) {
        return otherStoresMapper.getStore(id);
    }

    @Override
    public total getTotal(OtherQuery otherQuery) {
        return otherStoresMapper.getTotal(otherQuery);
    }


    @Override
    public boolean addStore(addOtherStore addOtherStore) {
        return otherStoresMapper.addStore(addOtherStore)>0;
    }
}
